﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace PROJECT_BOMBER.BLL
{
    public class ElementMove : ElementPhysique
    {

        public ElementMove(int x, int y, int width, int height, Vector2 speedmin, Vector2 speedmax) : base(x,y,width,height)
        {
            Speedmin = speedmin;
            Speedmax = speedmax;
        }

        public ElementMove(int x, int y)
            : this(x, y, 0, 0, Vector2.Zero, Vector2.Zero)
        {}

        private float _gravity = 1;

        public float Gravity
        {
            get { return _gravity; }
            set { _gravity = value; }
        }

        private int _inertia = 1;

        public int Inertia
        {
            get { return _inertia; }
            set 
            {
                if (value != 0)
                {
                    _inertia = value;
                }
            }
        }


        public override void UpdateAnimation()
        {
            if (Visible)
            {
                foreach (KeyValuePair<string, AnimationSprite> anim in Animations)
                {
                    anim.Value.Update(Case.X, Case.Y, Speed, (int)Speedmax.X, true);
                }
            }
        }
        


        private Vector2 _speed;

        public Vector2 Speed
        {
            get { return _speed; }
            set { _speed = value; }
        }

        private Vector2 _speedmin;

        public Vector2 Speedmin
        {
            get { return _speedmin; }
            set { _speedmin = value; }
        }

        private Vector2 _speedmax;

        public Vector2 Speedmax
        {
            get { return _speedmax; }
            set { _speedmax = value; }
        }

        private Vector2 _acceleration;

        public Vector2 Acceleration
        {
            get { return _acceleration; }
            set { _acceleration = value; }
        }

        #region Etats

        #region On ground

        int _onground = 0;

        /// <summary>
        /// Gets or sets the onground.
        /// </summary>
        /// <value>
        /// The ground's number in collision with the character
        /// </value>
        public int Onground
        {
            get { return _onground; }
            set { _onground = value; }
        }

        #endregion

        #region Dead
        private bool _dead = false;

        /// <summary>
        /// Gets or sets a value indicating whether this <see cref="Character"/> is dead.
        /// </summary>
        /// <value>
        ///   <c>true</c> if dead; otherwise, <c>false</c>.
        /// </value>
        public bool Dead
        {
            get { return _dead; }
            set { _dead = value; }
        }
        #endregion

        #region Jump
        private int _jump = 0;

        /// <summary>
        /// Gets or sets the jump.
        /// </summary>
        /// <value>
        /// The number of jump performed
        /// </value>
        public int Jump
        {
            get { return _jump; }
            set { _jump = value; }
        }
        #endregion

        #region ActiveSpeedX
        private bool _activeSpeedX = true;

        /// <summary>
        /// Gets or sets a value indicating whether the translation in X is active.
        /// </summary>
        /// <value>
        ///   <c>true</c> if active the translation in X; otherwise, <c>false</c>.
        /// </value>
        public bool ActiveSpeedX
        {
            get { return _activeSpeedX; }
            set { _activeSpeedX = value; }
        }
        #endregion

        #region JumpWall
        private bool _jumpWall = false;

        /// <summary>
        /// Gets or sets a value indicating whether [jump wall].
        /// </summary>
        /// <value>
        ///   <c>true</c> if [jump wall]; otherwise, <c>false</c>.
        /// </value>
        public bool JumpWall
        {
            get { return _jumpWall; }
            set { _jumpWall = value; }
        }
        #endregion

        #region Fly
        private bool _fly = false;

        /// <summary>
        /// Gets or sets a value indicating whether this <see cref="Character"/> is fly.
        /// </summary>
        /// <value>
        ///   <c>true</c> if fly; otherwise, <c>false</c>.
        /// </value>
        public bool Fly
        {
            get { return _fly; }
            set { _fly = value; }
        }
        #endregion

        #region Attack
        private bool _attack = false;

        /// <summary>
        /// Gets or sets a value indicating whether this <see cref="Character"/> is attack.
        /// </summary>
        /// <value>
        ///   <c>true</c> if attack; otherwise, <c>false</c>.
        /// </value>
        public bool Attack
        {
            get { return _attack; }
            set { _attack = value; }
        }
        #endregion

        #endregion



    }
}
